package com.srv.util;

import java.util.UUID;
public class IDGenerator {
   /**
    * 生产唯一ID
    * @return
    */
   public static final String createID(){
	   UUID uuid  =  UUID.randomUUID(); 
	   String s = UUID.randomUUID().toString();
	   //去掉"-"符号 
       return s.substring(0,8)+s.substring(9,13)+s.substring(14,18)+s.substring(19,23)+s.substring(24); 
   }
   /**
    * 生产指定个数的ID
    * @param number - 个数
    * @return
    */
   public static final String[] createID(int number){
	   if(number < 1){ 
           return null; 
       } 
       String[] ss = new String[number]; 
       for(int i=0;i<number;i++){ 
           ss[i] = createID(); 
       } 
       return ss;  
   }
   /**
    * 是否是合法的ID
    * @param id
    * @return
    */
   public static boolean isValid(String id){
	   if(id==null){ return false;}
	   if(id.length()!=32){return false;}
	   return true;
   }
   public static void main(String[] args){ 
       String[] ss = createID(10); 
       for(int i=0;i<ss.length;i++){ 
           System.out.println(ss[i]); 
       } 
       //
//	   String a="1s";
//	   System.out.println(Integer.parseInt(a));
   } 
   /*
85f01aeae2a448879dc7b3bfdc26f247
6a8391152cd4412dad7c24115213e329
8ba655a2214347abb5127e85cae48251
caada74e60f5424484959bc1a4a76f46
57e75ee96ad64f0e8e75e6e1e625dfe1
59112ffb98974458a6c6cdb6c458044b
cf7e5893c749480dac4d112958153bae
b95fc8c6032542c2b43b4b6bc0c8c7c2
97507162512a4f438c7ec434e9085bec
fe0e3e6f885f40e081d64a0ece943f32
*/
}
